<?php

use think\facade\Route;

$domain = ['Access-Control-Allow-Headers' => 'Authorization, Content-Type, If-Match, If-Modified-Since, If-None-Match, If-Unmodified-Since, X-CSRF-TOKEN, X-Requested-With, token, sign'];

/**
 * 申请商家
 */
Route::group('businessApply', function () {
    Route::get('/index', 'businessApply/index');
    Route::post('/add', 'businessApply/add');
})->middleware('verify');

/**
 * 商家中心首页
 */
Route::group('business', function () {
    Route::get('/index', 'business/index');
    Route::get('/read', 'business/read');
    Route::get('/getCate/:pid', 'business/getCate');
    Route::post('/save', 'business/save');
    Route::get('/census', 'business/census');
    Route::get('/draw', 'business/draw');
    Route::post('/drawApply', 'business/drawApply');
    Route::get('/drawRecord', 'business/drawRecord');
    Route::get('/fundsFlow', 'business/fundsFlow');
    Route::get('/fundsInfo', 'business/fundsInfo');
    Route::post('/videoApply', 'business/videoApply');
})->middleware('verifyBusiness');

/**
 * 商家中心 - 规格管理
 */
Route::group('businessSpec', function () {
    Route::get('/index', 'businessSpec/index');
    Route::get('/read/:id', 'businessSpec/read');
    Route::post('/createSku', 'businessSpec/createSku');
    Route::post('/save', 'businessSpec/save');
    Route::delete('/delete/:id', 'businessSpec/delete');
})->middleware('verifyBusiness');


/**
 * 商家中心 - 商品管理
 */
Route::group('businessProduct', function () {
    Route::get('/index', 'businessProduct/index');
    Route::get('/read/:id', 'businessProduct/read');
    Route::get('/getSpec/:id', 'businessProduct/getSpec');
    Route::get('/getCateSpec/:cate_3', 'businessProduct/getCateSpec');
    Route::get('/getService', 'businessProduct/getService');
    Route::post('/save', 'businessProduct/save');
    Route::post('/update', 'businessProduct/update');
    Route::post('/updateStock', 'businessProduct/updateStock');
})->middleware('verifyBusiness');

/**
 * 商家中心 - 订单管理
 */
Route::group('businessOrder', function () {
    Route::get('/index', 'businessOrder/index');
    Route::get('/info/:id', 'businessOrder/info');
    Route::get('/deliverFront/:id', 'businessOrder/deliverFront');
    Route::post('/deliverSave', 'businessOrder/deliverSave');
    Route::get('/getRefundOrder', 'businessOrder/getRefundOrder');
    Route::get('/getRefundOrderInfo/:id', 'businessOrder/getRefundOrderInfo');
    Route::post('/editRefundOrder', 'businessOrder/editRefundOrder');
    Route::get('/getEvaluate', 'businessOrder/getEvaluate');
    Route::get('/getEvaluateInfo/:id', 'businessOrder/getEvaluateInfo');
    Route::get('/getWriteOffOrder/:code', 'businessOrder/getWriteOffOrder');
    Route::post('/replyEvaluate', 'businessOrder/replyEvaluate');
    Route::post('/confirmWriteOff', 'businessOrder/confirmWriteOff');
})->middleware('verifyBusiness');

/**
 * 视频相关
 */
Route::group('businessVideo', function () {
    Route::post('/store', 'businessVideo/store');
    Route::get('/token', 'businessVideo/token');
    Route::get('/index', 'businessVideo/index');
    Route::get('/info', 'businessVideo/info');
    Route::get('/product', 'businessVideo/product');
    Route::delete('/del', 'businessVideo/del');
    Route::get('/hitList', 'businessVideo/hitList');
    Route::get('/commentList', 'businessVideo/commentList');
    Route::post('/delComment', 'businessVideo/delComment');
    Route::post('/commentDelOrder', 'businessVideo/commentDelOrder');
    //Route::post('/addTag', 'businessVideo/addTag');
    Route::get('/tagList', 'businessVideo/tagList');
})->middleware('verifyBusiness');

